\hypertarget{adding_enemies_secAddingEnemies}{}\section{Adding new enemies}\label{adding_enemies_secAddingEnemies}
Instructions for adding new enemy game objects to the game. These instructions assume OpenGL ES 2 is used for rendering game objects.\hypertarget{adding_enemies_secGameWidget}{}\subsection{Changing the GameWidget class}\label{adding_enemies_secGameWidget}

\begin{DoxyItemize}
\item Define an enemy object graphics in a {\ttfamily \hyperlink{class_game_widget}{GameWidget}} class
\begin{DoxyItemize}
\item OpenGL graphics are defined in file {\ttfamily \hyperlink{gamewidget__graphics_8cpp}{gamewidget\_\-graphics.cpp}} 
\item See {\ttfamily \hyperlink{class_game_widget_a0219045534281ae4b67be7824f66f4d6}{GameWidget::initMissile()}} for an example
\item Call graphics initialization from {\ttfamily \hyperlink{class_game_widget_ab4fc4fb4ef800bfd742e4b6045ff42e7}{GameWidget::initObjects()}}.
\end{DoxyItemize}
\end{DoxyItemize}


\begin{DoxyItemize}
\item Paint the enemy
\begin{DoxyItemize}
\item Create an OpenGL paint method for the new enemy object in {\ttfamily \hyperlink{class_game_widget}{GameWidget}} 
\begin{DoxyItemize}
\item OpenGL ES 2 specific paint medhods are implemented in file {\ttfamily \hyperlink{gamewidget___g_les2_8cpp}{gamewidget\_\-GLes2.cpp}} 
\item See {\ttfamily \hyperlink{class_game_widget_aa0086382830bc99c60f6064b41926ae3}{GameWidget::GLes2PaintMissile}} for an example
\end{DoxyItemize}
\item Call the paint method from {\ttfamily \hyperlink{class_game_widget_a82c9e46d44d3b2691e56dabfab62bb7a}{GameWidget::GLes2Paint()}} 
\end{DoxyItemize}
\end{DoxyItemize}\hypertarget{adding_enemies_secGameObject}{}\subsection{Creating a game object class and setting level properties}\label{adding_enemies_secGameObject}

\begin{DoxyItemize}
\item Define the enemy object class and its properties
\begin{DoxyItemize}
\item New game objects are derived from {\ttfamily \hyperlink{class_game_object}{GameObject}} class
\item If needed, {\ttfamily \hyperlink{class_rotating_object}{RotatingObject}} class provides properties for rotating the game object, for example {\ttfamily \hyperlink{class_missile}{Missile}} class
\item New enumerations and constants are needed to create a new {\ttfamily \hyperlink{class_game_object}{GameObject}} type, see {\ttfamily \hyperlink{class_game_object}{GameObject}} 
\end{DoxyItemize}
\item Add enemy information to level data (if necessary -\/ some enemies may appear in consequense of other game events such as missiles fired by UFOs)
\begin{DoxyItemize}
\item Create a field in {\ttfamily \hyperlink{struct_game_level_data}{GameLevelData}} structure
\item Set a value for field for each level in {\ttfamily \hyperlink{class_game_level_aca629b96870f97fe36512357b4b016bb}{GameLevel::createData()}}.
\end{DoxyItemize}
\end{DoxyItemize}\hypertarget{adding_enemies_secGameEngine}{}\subsection{Changing the GameEngine class}\label{adding_enemies_secGameEngine}

\begin{DoxyItemize}
\item Add enemies to a game engine
\begin{DoxyItemize}
\item Trigger more enemies at randomly selected level progress points
\begin{DoxyItemize}
\item Create a trigger list for a new enemy, for example {\ttfamily \hyperlink{class_game_engine_a1ba36346aa3811b0f5b79882f861d786}{GameEngine::triggerUfo}}.
\item Initialize the trigger list in {\ttfamily \hyperlink{class_game_engine_acd585297a9283fd6567744c82d8133cc}{GameEngine::initNextLevel()}} 
\end{DoxyItemize}
\item Create instances of enemy objects in {\ttfamily \hyperlink{class_game_engine_a385a685ce0e33310f6d943d1850c1398}{GameEngine::moreGameObjects()}} 
\begin{DoxyItemize}
\item Populate the game with game objects regarding to trigger lists
\item Append new enemies to {\ttfamily \hyperlink{class_game_engine_af9868f8ba59c50ff8686217f102c450a}{GameEngine::enemyList}} 
\end{DoxyItemize}
\item Handle movement
\begin{DoxyItemize}
\item Advance new enemy objects in {\ttfamily \hyperlink{class_game_engine_aae2169c42cd517e0989e8a03c9e36b3e}{GameEngine::advanceGameObjects()}} 
\end{DoxyItemize}
\item Handle collision detection if extra functionality is needed
\begin{DoxyItemize}
\item Optional since {\ttfamily \hyperlink{class_game_engine_a6e804b50ae2d2d7b4ce557b8323d0a47}{GameEngine::detectCollisions()}} goes through the enemy list and detects collisions between the miner and the enemy objects
\end{DoxyItemize}
\item Optional extra features may be implemented in {\ttfamily \hyperlink{class_game_engine_a18954e6a69916acac6a548b10532d310}{GameEngine::controlGameEvents()}} 
\begin{DoxyItemize}
\item For example UFO shooting missiles
\end{DoxyItemize}
\end{DoxyItemize}
\end{DoxyItemize}\hypertarget{adding_enemies_droppingEnemies}{}\section{Dropping existing enemies}\label{adding_enemies_droppingEnemies}
Instructions for dropping existing enemy game objects from the game.\hypertarget{adding_enemies_secDisableEnemy}{}\subsection{Disable existing enemies}\label{adding_enemies_secDisableEnemy}
Easiest method to disable existing enemies in game is to set amount of enemy types being removed to 0 in {\ttfamily \hyperlink{class_game_level_aca629b96870f97fe36512357b4b016bb}{GameLevel::createData()}} \hypertarget{adding_enemies_secRemoveEnemy}{}\subsection{Remove an existing enemy}\label{adding_enemies_secRemoveEnemy}
\hypertarget{adding_enemies_ssecRemoveLevelData}{}\subsubsection{Removing level data}\label{adding_enemies_ssecRemoveLevelData}

\begin{DoxyItemize}
\item Remove the data field from game level data {\ttfamily \hyperlink{struct_game_level_data}{GameLevelData}} regarding the enemy being removed.
\item Remove populating of the level data for the data field from {\ttfamily \hyperlink{class_game_level_aca629b96870f97fe36512357b4b016bb}{GameLevel::createData()}}.
\end{DoxyItemize}\hypertarget{adding_enemies_ssecRemoveEnemiesGameEngine}{}\subsubsection{Changing the GameEngine}\label{adding_enemies_ssecRemoveEnemiesGameEngine}

\begin{DoxyItemize}
\item Remove triggering of enemies
\begin{DoxyItemize}
\item Remove the initialising trigger list from {\ttfamily \hyperlink{class_game_engine_acd585297a9283fd6567744c82d8133cc}{GameEngine::initNextLevel()}} 
\item It is a good idea to remove also the obsoleted trigger list from {\ttfamily \hyperlink{class_game_engine}{GameEngine}} header
\end{DoxyItemize}
\end{DoxyItemize}


\begin{DoxyItemize}
\item Remove populating game level with the enemy type in {\ttfamily \hyperlink{class_game_engine_a385a685ce0e33310f6d943d1850c1398}{GameEngine::moreGameObjects()}} 
\begin{DoxyItemize}
\item Remove trigger list handling and appending enemies to {\ttfamily \hyperlink{class_game_engine_af9868f8ba59c50ff8686217f102c450a}{GameEngine::enemyList}} 
\end{DoxyItemize}
\end{DoxyItemize}


\begin{DoxyItemize}
\item Remove movement handling from {\ttfamily \hyperlink{class_game_engine_aae2169c42cd517e0989e8a03c9e36b3e}{GameEngine::advanceGameObjects()}} 
\end{DoxyItemize}


\begin{DoxyItemize}
\item Remove collision detection handling from {\ttfamily \hyperlink{class_game_engine_a6e804b50ae2d2d7b4ce557b8323d0a47}{GameEngine::detectCollisions()}} 
\end{DoxyItemize}


\begin{DoxyItemize}
\item Remove possible additional features implemented for the enemy type from {\ttfamily \hyperlink{class_game_engine_a18954e6a69916acac6a548b10532d310}{GameEngine::controlGameEvents()}} 
\begin{DoxyItemize}
\item Such as UFO shooting missiles
\begin{DoxyItemize}
\item When removing UFO, remove also the missile logic
\end{DoxyItemize}
\end{DoxyItemize}
\end{DoxyItemize}\hypertarget{adding_enemies_ssecRemoveEnemyGameWidget}{}\subsubsection{Changing the GameWidget class}\label{adding_enemies_ssecRemoveEnemyGameWidget}
Remove the obsoleted graphics definitions and painting methods.
\begin{DoxyItemize}
\item Remove graphics definitions (for example {\ttfamily \hyperlink{class_game_widget_a0219045534281ae4b67be7824f66f4d6}{GameWidget::initMissile()}}) from {\ttfamily \hyperlink{gamewidget__graphics_8cpp}{gamewidget\_\-graphics.cpp}} 
\item Remove graphics initialization call from {\ttfamily \hyperlink{class_game_widget_ab4fc4fb4ef800bfd742e4b6045ff42e7}{GameWidget::initObjects()}} 
\item Remove the paint method from {\ttfamily \hyperlink{class_game_widget}{GameWidget}} 
\begin{DoxyItemize}
\item OpenGL ES 2 specific paint methods are implemented in {\ttfamily \hyperlink{gamewidget___g_les2_8cpp}{gamewidget\_\-GLes2.cpp}} file, for example {\ttfamily \hyperlink{class_game_widget_aa0086382830bc99c60f6064b41926ae3}{GameWidget::GLes2PaintMissile}} 
\end{DoxyItemize}
\item Remove the paint method call from {\ttfamily \hyperlink{class_game_widget_a82c9e46d44d3b2691e56dabfab62bb7a}{GameWidget::GLes2Paint()}} 
\end{DoxyItemize}\hypertarget{adding_enemies_ssecRemoveEnemyGameObject}{}\subsubsection{Removing enemy game object}\label{adding_enemies_ssecRemoveEnemyGameObject}

\begin{DoxyItemize}
\item Remove the obsoleted game object
\item Remove the obsoleted {\ttfamily GameObjectType} and other enumerations and constants, see {\ttfamily \hyperlink{class_game_object}{GameObject}} 
\end{DoxyItemize}\hypertarget{adding_enemies_secRemovingBlackHole}{}\subsection{Removing the black hole}\label{adding_enemies_secRemovingBlackHole}
\hypertarget{adding_enemies_ssecRemovingBlackHole_GameWidget}{}\subsubsection{Removes the black hole specific OpenGL painting}\label{adding_enemies_ssecRemovingBlackHole_GameWidget}

\begin{DoxyItemize}
\item There are shader programs specified to handle effects such as black hole rendering
\begin{DoxyItemize}
\item When removing the black hole enemy the black hole data is no more needed in the shader programs
\item for example in vsrcConstantMaterialEff3D: 
\begin{DoxyCode}
   uniform mediump vec4 bhdata4;
\end{DoxyCode}

\item The code of shader programs is in {\ttfamily \hyperlink{class_game_widget_a39892919b2216f1e7834ea76205ca307}{GameWidget::GLes2Initialize()}} in {\ttfamily \hyperlink{gamewidget___g_les2_8cpp}{gamewidget\_\-GLes2.cpp}} 
\item When the black hole is removed the following shader programs become obsolete
\begin{DoxyItemize}
\item {\ttfamily \hyperlink{class_game_widget_a1722618b49cae76fd3ad3b518364bef0}{GameWidget::programConstanMaterialEffect3D}} 
\item {\ttfamily \hyperlink{class_game_widget_a2dcfaa6eb9dcf1b1d84af0f772a01a98}{GameWidget::programConstantMaterialSpecularEffect3D}} 
\item {\ttfamily \hyperlink{class_game_widget_a90e8af2de1e60d6272890318d9668075}{GameWidget::programVariableMaterial3D}} 
\item {\ttfamily \hyperlink{class_game_widget_a26d451e2c1c95a48a66aa331dfb63b29}{GameWidget::programParticlesEffect2D}} 
\item {\ttfamily \hyperlink{class_game_widget_aeab483ee8fa170ce6ec970e272a80481}{GameWidget::programTextureEffects3D}} 
\end{DoxyItemize}
\item {\ttfamily \hyperlink{class_game_widget_a18dcde54ab56df4a01359f65822b6ec8}{GameWidget::programBackgroundEffect2D}} is used for rendering the black hole and bomb effects
\item When removing the black hole data field from shader program code, remove the data field also from the shader program class
\item When removing the black hole, the following shader program classes become obsolete:
\begin{DoxyItemize}
\item {\ttfamily \hyperlink{classsp_constant_material_eff3_d}{spConstantMaterialEff3D}} 
\item {\ttfamily \hyperlink{classsp_variable_material_eff3_d}{spVariableMaterialEff3D}} 
\item {\ttfamily \hyperlink{classsp_particles_eff2_d}{spParticlesEff2D}} 
\item {\ttfamily \hyperlink{classsp_texture_eff3_d}{spTextureEff3D}} 
\end{DoxyItemize}
\end{DoxyItemize}
\item Every paint method has a black hole specific code block
\begin{DoxyItemize}
\item See the {\ttfamily paintWithBlackHole} code blocks
\end{DoxyItemize}
\end{DoxyItemize}\hypertarget{adding_enemies_ssecRemovingBlackHole_engine}{}\subsubsection{Changing the GameEngine}\label{adding_enemies_ssecRemovingBlackHole_engine}

\begin{DoxyItemize}
\item {\ttfamily \hyperlink{class_black_hole}{BlackHole}} instance is used with {\ttfamily \hyperlink{class_game_engine_a229e3ca1a881bd6d7b41a6ed2aead5cb}{GameEngine::blackhole}} pointer.
\item {\ttfamily \hyperlink{class_game_engine_ad495614f182737556a600a147a593935}{GameEngine::doBlackHoleEffect()}} becomes obsolete.
\item Remove {\ttfamily GameLevelData::blackhole} and usage in {\ttfamily \hyperlink{class_game_level_aca629b96870f97fe36512357b4b016bb}{GameLevel::createData()}}. 
\end{DoxyItemize}